class CreateUsers < ActiveRecord::Migration
  def change
    create_table :groups do |t|
      t.text :name

      t.timestamps null: false
    end
    create_table :users do |t|
      t.string :name
      t.string :email
      t.boolean :admin, default: false
      t.string :password_digest
      t.references :group, index: true, foreign_key: true, null: true
      t.references :dev, polymorphic: true
      t.references :test, polymorphic: true
      t.timestamps null: false
    end
    create_table :apps do |t|
      t.string :name
      t.string :version
      t.boolean :isfinished, default: false
      t.integer :crash_rate
      t.integer :dev_id
      t.integer :test_id
      t.integer :parent_id
      t.datetime :released_date
      t.references :group, index: true, foreign_key: true, null: true

      t.timestamps null: false
    end
  end
end
